#include "runerr.h"

RunErr::RunErr(QWidget *parent)
:QWidget{parent}
,_ui(new Ui::RunErr)
{
    _ui->setupUi(this);

    connect(_ui->pb_again,      SIGNAL(clicked(bool)), this, SLOT(onDealUserEvent(bool)));
    connect(_ui->pb_ingore,     SIGNAL(clicked(bool)), this, SLOT(onDealUserEvent(bool)));
    connect(_ui->pb_stop,       SIGNAL(clicked(bool)), this, SLOT(onDealUserEvent(bool)));
}

void RunErr::SetTitle(QString Str)
{
    _ui->lb_title->setText(Str);
}

void RunErr::SetDetail(QString Str)
{
    _ui->te_detail->setText(Str);
}

void RunErr::onDealUserEvent(bool sta)
{
    QPushButton *pBtn = (QPushButton *)sender();
    if(_ui->pb_again == pBtn)
    {
        emit SigEvent(E_RUN_ERR_FLAG_again);
    }
    else if(_ui->pb_ingore == pBtn)
    {
        emit SigEvent(E_RUN_ERR_FLAG_ingore);
    }
    else if(_ui->pb_stop == pBtn)
    {
        emit SigEvent(E_RUN_ERR_FLAG_stop);
    }
}

void RunErr::closeEvent(QCloseEvent *event)
{
     emit SigEvent(E_RUN_ERR_FLAG_ingore);
}
